/**
  ******************************************************************************
  * File Name          : gpio.c
  * Description        : This file provides code for the configuration
  *                      of all used GPIO pins.
  ******************************************************************************
  * @attention
  *
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "bsp.h"
#include "tskcfg.h"
/*----------------------------------------------------------------------------*/
/* Configure GPIO                                                             */
/*----------------------------------------------------------------------------*/

/** Configure pins as 
        * Analog 
        * Input 
        * Output
        * EVENT_OUT
        * EXTI
*/
void SystemIO_Config(void)
{
	rcu_periph_clock_enable(RCU_GPIOB);
	rcu_periph_clock_enable(RCU_GPIOC);
	rcu_periph_clock_enable(RCU_GPIOD);
	rcu_periph_clock_enable(RCU_GPIOE);
	
	gpio_bit_reset(GPIOC, RELAY01_Pin|RELAY02_Pin);
	gpio_bit_reset(GPIOB, RELAY03_Pin|RELAY04_Pin|RELAY05_Pin);
  gpio_bit_reset(GPIOE, RELAY06_Pin|RELAY07_Pin|RELAY08_Pin|RELAY09_Pin|RELAY10_Pin|RELAY11_Pin|RELAY12_Pin);
  
	gpio_bit_set(GPIOB, LED1_Pin|LED2_Pin|LED4_Pin);
	gpio_bit_set(GPIOC, LED3_Pin|LED5_Pin);
	
	gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, LED1_Pin|LED2_Pin|LED4_Pin);
	gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, LED1_Pin|LED2_Pin|LED4_Pin);
	
	gpio_mode_set(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, LED3_Pin|LED5_Pin);
	gpio_output_options_set(GPIOC, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, LED3_Pin|LED5_Pin);
	
  
  gpio_mode_set(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, RELAY01_Pin|RELAY02_Pin);
	gpio_output_options_set(GPIOC, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, RELAY01_Pin|RELAY02_Pin);
  
	gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, RELAY03_Pin|RELAY04_Pin|RELAY05_Pin);
	gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_2MHZ, RELAY03_Pin|RELAY04_Pin|RELAY05_Pin);
	
	gpio_mode_set(GPIOE, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, RELAY06_Pin|RELAY07_Pin|RELAY08_Pin|RELAY09_Pin|RELAY10_Pin|RELAY11_Pin|RELAY12_Pin);
	gpio_output_options_set(GPIOE, GPIO_OTYPE_PP, GPIO_OSPEED_2MHZ, RELAY06_Pin|RELAY07_Pin|RELAY08_Pin|RELAY09_Pin|RELAY10_Pin|RELAY11_Pin|RELAY12_Pin);
  
  gpio_mode_set(KEY_NET_GPIO_Port, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, KEY_NET_Pin);
}

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
